package string;

public class MatchesDemo05 {
    public static void main(String[] args) {
        String file = "demo.jpg";
        boolean match = file.matches(".+\\.jpg");
        if(match){
            System.out.println("这个是 jpg 文件");
        }else{
            System.out.println("不是JPG文件");
        }

        file = "demo_jpg";
        match = file.matches(".+\\.jpg");
        if(match){
            System.out.println("这个是 jpg 文件");
        }else{
            System.out.println("不是JPG文件");
        }


    }
}
